<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>欢迎访问产品运营互动中心！</title>
<link rel="stylesheet" href="<s:url value="/css/style_new.css"/>">
<link href="<s:url value="/images/08_ccxxzx.css"/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<s:url value="/script/sysOper.js"/>"></script>
<script type="text/javascript" src="<s:url value="/script/selfResize.js"/>"></script>
<script type="text/javascript" src="<s:url value="/components/datepicker/WdatePicker.js"/>"></script>
<script>
function show(url){
	window.open(url);
}
function initLoad(){
	f_iframeResize();
}
window.onload = initLoad;
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0">
<table width="980" border="0" cellspacing="0" cellpadding="0" align="center">
		<tr>
			<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="0"
				background="<s:url value="/images/new/gxzl_index_2.gif"/>">
				<tr>
					<td width="20" height="32">&nbsp;</td>
					<td width="20"><img
						src="<s:url value="/images/new/dq_dot.gif"/>" width="15"
						height="12" /></td>
					<td>当前位置：业务需求交互单-新增产品需求单</td>

				</tr>
			</table>
			</td>
		</tr>
	<tr>
		<td background="<s:url value="/images/home_4a.gif"/>">
		<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
			<tr>
				<td width="20%" valign="top">
				<table width="100%" height="400"  border="0" cellspacing="0" cellpadding="0"
					align="center" bgcolor="#FFFFFF">
					<tr>
						<td valign="top" align="center">
						<s:form action="saveProdAdvReq.action" namespace="/bpm" method="post" enctype="multipart/form-data">
							<input type="hidden" name="flag" value="">
							<input type="hidden" name="prodAdvReq.id" value="${prodAdvReq.id}">
							<input type="hidden" name="prodAdvReq.begin" value="${prodAdvReq.begin}">
							<input type="hidden" name="prodAdvReq.end" value="${prodAdvReq.end}">
							<input type="hidden" name="prodAdvReq.opType" value="${prodAdvReq.opType}">
							<input type="hidden" name="prodAdvReq.relaReq" value="${prodAdvReq.relaReq}">
							<input type="hidden" name="prodAdvReq.tranStatus" value="${prodAdvReq.tranStatus}">
							<input type="hidden" name="prodAdvReq.tranReason" value="${prodAdvReq.tranReason}">
							<input type="hidden" name="prodAdvReq.verifyExplain" value="${prodAdvReq.verifyExplain}">
							<input type="hidden" name="advice" value="">
							<table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">
								<br/>
								<tr>
									<td height="5">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="5" height="5"><img src="<s:url value="/images/cphdzx_tab1.gif"/>" width="5" height="5" /></td>
												<td class="tdborderup"><img src="<s:url value="/images/spacer.gif"/>" width="1" height="1" /></td>
												<td width="5"><img src="<s:url value="/images/cphdzx_tab2.gif"/>" width="5" height="5" /></td>
											</tr>
										</table>
									</td>
								</tr>
								<tr>
									<td  class="tdborderleftright">
									<TABLE width="98%" cellSpacing=1 cellPadding=0 align="center">
										<TR height=30>
											<TD align=left width="10%"><input type="submit" name="Submit" value="保 存" onclick="return save();"><input type="button"
												value="返 回" onClick="location.href='/bpm/listProdAdvReq.action'">
									<s:if test='%{prodAdvReq.tranStatus=="WAIT"}'>
									<input type="submit" value="回 退" onClick="return refuse();">
												<input type="submit" value="接 收" onClick="return pending();">
									</s:if>
									<s:if test='%{prodAdvReq.tranStatus=="PENDING"}'>
												<input type="submit" value="回 退" onClick="return refuse();">
												<input type="submit" value="审 核" onClick="return pass();">
									</s:if>
									<s:if test='%{prodAdvReq.tranStatus==null||prodAdvReq.tranStatus==""||prodAdvReq.tranStatus=="NEW"}'>
												<input type="submit" name="Submit" value="提交审核" onclick="return  submit1();">
									</s:if>
									<s:if test='%{prodAdvReq.tranStatus=="REFUSE"}'>
												<input type="submit" name="Submit" value="提交审核" onclick="return  submit2();">
									</s:if>
									<s:if test='%{prodAdvReq.tranStatus=="PASS"}'>
												<input type="submit" value="流程启动" onClick="return startup();">
									</s:if>
											</TD>
										</TR>
									</table><br>
									<s:if test='%{prodAdvReq.reqCode!=null}'>
										&nbsp;&nbsp;&nbsp;需求单号：${prodAdvReq.reqCode}
									</s:if>
									<table width="98%" border="0" cellspacing="0" cellpadding="7"
										align="center" class=tablecolor2>
										
                  <tr>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2"><font color="red">*</font>需求名称：</div></td>
                    <td colspan="3">
											<s:textfield name="prodAdvReq.name" theme="css_xhtml" size="110" />
                    </td>
                  </tr>
									<tr>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2">发 起 人：</div></td>
                    <td width="286">
											<input type="hidden" name="prodAdvReq.startPerson.id" value="${prodAdvReq.startPerson.id}">
											<input type="text" name="startPerson" readonly value="${prodAdvReq.startPerson.name}" class="input_nob" size="40">
                    </td>
                    <td bgcolor="D6E3FA" width="140"><div align="right" class="STYLE2">发起部门：</div></td>
                    <td width="268">
                    	<input type="text" name="startDept" value="${prodAdvReq.startDept.fullName}" class="input_nob" size="40" readonly>
                    	<input type="hidden" name="prodAdvReq.startDept.id" value="${prodAdvReq.startDept.id}" >
                    </td>
                  </tr>
                  <tr>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2">期望完成时间：</div></td>
                    <td>
												<input type="text" name="advanTime" size="14" class="Wdate" onFocus="new WdatePicker(this)">
												<s:date name="prodAdvReq.advanTime" format="yyyy年MM月dd日"/>
												<input name="prodAdvReq.advanTime" type="hidden" value="${prodAdvReq.advanTime}">
                    </td>
                    <td bgcolor="D6E3FA" width="140"><div align="right" class="STYLE2">发起时间：</div></td>
                    <td width="268">
												<s:date name="prodAdvReq.begin" format="yyyy年MM月dd日 hh:mm"/>
                    </td>
                  </tr>
					
                  <tr>
                    <td bgcolor="D6E3FA" width="140"><div align="right" class="STYLE2">产品经理：</div></td>
                    <td width="268">
											<input type="hidden" name="prodAdvReq.prodPerson.id" value="${prodAdvReq.prodPerson.id}">
											<input type="text" name="prodPerson" readonly value="${prodAdvReq.prodPerson.name}">
                    	<input type="button" name="人员选择" value="人员选择" class="buttoncom4" onclick="selectPersonsBy()" />
                    </td>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2">产品部门：</div></td>
                    <td>
                    	<input type="text" name="prodDept" value="${prodAdvReq.prodDept.fullName}" 
                    	 class="input_nob" size="40" readonly>
                    	<input type="hidden" name="prodAdvReq.prodDept.id" value="${prodAdvReq.prodDept.id}" >
                    </td>
                  </tr>
                  <tr>
                    <td bgcolor="D6E3FA" width="140"><div align="right" class="STYLE2">需求类别：</div></td>
                    <td width="268">
					<s:select name="prodAdvReq.type.id"
						list="types" listKey="id" listValue="name"
						theme="css_xhtml" />
                    </td>
									<s:if test='%{prodAdvReq.tranStatus=="PENDING"||prodAdvReq.tranStatus=="PASS"}'>
                    <td bgcolor="D6E3FA" width="140"><div align="right" class="STYLE2">重要性：</div></td>
                    <td width="268">
						<s:select name="prodAdvReq.importance.id"
							list="importances" listKey="id" listValue="name"
							theme="css_xhtml" />
                    </td>
									</s:if>
									<s:else>
                    <td bgcolor="D6E3FA" width="140"></td>
                    <td width="268">
                    	
                    </td>
									</s:else>
                  </tr>
				  <tr>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2"><font color="red">*</font>优化内容：</div></td>
                    <td colspan="3">
											<s:textarea name="prodAdvReq.content" theme="css_xhtml" cols="96" rows="4" />
					  </td>
                  </tr>
                  <tr> 
                    <td width="111" bgcolor="D6E3FA"> <div align="right" class="STYLE2">附&nbsp;&nbsp;&nbsp;&nbsp;件：</div></td>
                    <td colspan="3">
					<table width="90%" border="0" class=tablecolor2>
						<tr>
							<td width="40%" align="center" bgcolor="D6E3FA">附件名称</td>
							<td width="20%" align="center" bgcolor="D6E3FA">附件类型</td>
							<td width="15%" align="center" bgcolor="D6E3FA">上传人</td>
							<td width="15%" align="center" bgcolor="D6E3FA">上传时间</td>
							<td width="10%" align="center" bgcolor="D6E3FA">删除</td>
						</tr>
						<s:iterator id="reqDocu" value="reqDocus">
						<input type="hidden" name="attachIDs" value="<s:property value="id" />"/>
						<tr>
							<td>
								<a href="<s:url value="/bpm/showDocu.action?reqDocu.id="/><s:property value="id" />"
									target="_blank">
									<s:property value="fullName" />
								</a>
							</td>
							
							<td align="center"> 
								<s:if test="docType==null">
									其他附件
								</s:if>	
								<s:else>
									<s:property value="docType.name"/>
								</s:else>	
							</td>
							<td align="center"> 
								<s:property value="creator"/>
							</td>
							<td align="center"> 
								<s:property value="begin"/>
							</td>
							<td align="center">
								<input type="checkbox" name="delIDs" value="<s:property value="id" />">
							</td>
						</tr>
						</s:iterator>
					</table>
					<br>
                      <table width="90%" border="0" class=tablecolor2>
                        <tr>
                          <td width="" colspan="2" align="left" bgcolor="D6E3FA">附件上传</td>
                        </tr>
                        <tr>
                          <td width="120px">产品优化需求说明书
                          	<input type="hidden" id="filetype" name="filetype" value="" /></td>
                          <td align="left">
                          	<input type="file" name="upload" size="40"/>&nbsp;&nbsp;&nbsp;
                          	<a href="/common/req_doc_temp.doc" target="_blank">
                          	模板下载
                          	</a>
                          </td>
                        </tr>
                        <tr>
                          <td>其他附件
                          	<input type="hidden" id="filetype" name="filetype" value="" /></td>
                          <td><input type="file" name="upload" size="40"/>
                          </td>
                        </tr>
                        <tr>
                          <td>其他附件
                          	<input type="hidden" id="filetype" name="filetype" value="" /></td>
                          <td><input type="file" name="upload" size="40"/>
                          </td>
                        </tr>
                      </table>
                      </div></td>
                  </tr>

                  <tr>
                    <td bgcolor="D6E3FA"><div align="right" class="STYLE2">备&nbsp;&nbsp;&nbsp;&nbsp;注：</div></td>
                    <td colspan="3">
											<s:textarea name="prodAdvReq.remark" theme="css_xhtml" cols="96" rows="4" />
					  				</td>
                  </tr>
                  
                </table>
								<s:if test="prodAdvReq.tranReason!=null">
									<table width="98%" border="0" cellspacing="0" cellpadding="7"
										align="center" class=tablecolor2>
                  <tr>
                    <td bgcolor="D6E3FA"><div align="left" class="STYLE2">办理记录</div></td>
                  </tr>
                  <tr>
                    <td colspan="3">
											${prodAdvReq.tranReason}
					  				</td>
                  </tr>
                </table>
								</s:if>	
										
										
									</td>
								</tr>
								<tr>
									<td height="5">
										<table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="5" height="5"><img src="<s:url value="/images/cphdzx_tab3.gif"/>" width="5" height="5" /></td>
												<td class="tdborderbottom"><img src="<s:url value="/images/spacer.gif"/>" width="1" height="1" /></td>
												<td width="5"><img src="<s:url value="/images/cphdzx_tab4.gif"/>" width="5" height="5" /></td>
											</tr>
										</table>
									</td>
								</tr>
							</table></td>
					</tr>
				</table>
				</s:form> 
</body>
<script>
//验证表单
function check(){
	var contcontent = document.all['prodAdvReq.content'].value;
	if(contcontent.length > 500){
		alert("优化内容不大于500个字！请简写或者用附件上传！");
		return false;
	}
	if(document.all['prodAdvReq.name'].value==""){
		alert("需求名称不能为空，请输入！");
		return false;
	}
	if(contcontent==""){
		alert("优化内容不能为空，请输入！");
		return false;
	}
	var time2=document.all['advanTime'].value;
	if(time2.length==10){
		document.all['prodAdvReq.advanTime'].value=document.all['advanTime'].value+" 00:00:00";
	}
	return true;
}


function uploadsave(){
	var uploads = document.getElementsByName("upload");
	var filetype = document.getElementsByName("filetype");
	if(uploads[0].value != null && uploads[0].value != ""){
		filetype[0].value = "CPGJXQSMS";
	}else{
		filetype[0].value = "";
	}
}

function save(){
	uploadsave();
	document.all['flag'].value="";
	return check();

}
function submit1(){
	uploadsave();
	if( !check()){
		return false;
	}
	
	if(!confirm("您正要【提交审核】，确认要执行吗？")){
		return false;
	}
	document.all['flag'].value="WAIT";
	return true;
}
function submit2(){
	uploadsave();
	if( !check()){
		return false;
	}
	
	if(!confirm("您正要【提交审核】，确认要执行吗？")){
		return false;
	}
  var url="<s:url value='/' escapeAmp='false'/>"+"bpm/inputMessage.action";	 
  var returnData=window.showModalDialog(url,window,"status:no;dialogWidth:550px;dialogHeight:250px;scroll:yes;");
	if(returnData){
		document.forms[0]["advice"].value=returnData;
	}else{
		return false;
	}
	document.all['flag'].value="WAIT";
	return true;
}
function refuse(){
	document.all['flag'].value="REFUSE";
	return check();
}
function pending(){
	document.all['flag'].value="PENDING";
	return check();
}
function pass(){
	if(document.all['prodAdvReq.prodPerson.id'].value==""){
		alert("产品经理不能为空，请选择！");
		return false;
	}
	if( !check()){
		return false;
	}
	if(!confirm("您正要【拒绝】，确认要执行吗？")){
		return false;
	}
	document.all['flag'].value="PASS";
	return true;
}

function startup(){
	if( !check()){
		return false;
	}
	document.forms[0].action='startupProdAdvReq.action';
	return true;
}

function isNullSel(obj){
	if(obj&&obj.options&&obj.options.selectedIndex!=-1&&obj.options[obj.options.selectedIndex].value!=""){
		return false;
	}
	return true;
}
function selectPersonsBy(){
	var url="<s:url value='/' escapeAmp='false'/>"+"organ/selectPerson.action";	
	var returnData=window.showModalDialog(url,window,"status:no;dialogWidth:960px;dialogHeight:640px;scroll:yes;");
	if(returnData){
		document.all['prodPerson'].value=returnData[1];
		document.all['prodAdvReq.prodPerson.id'].value=returnData[0];
		document.all['prodDept'].value="";
		document.all['prodAdvReq.prodDept.id'].value="";
	}
}

</script>
</html>